//
//  MainViewController.m
//  Text
//
//  Created by 李志远 on 16/5/4.
//  Copyright © 2016年 李志远. All rights reserved.
//

#import "MainViewController.h"
#import "SecondViewController.h"

@interface MainViewController ()

@end

@implementation MainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    //隐藏导航栏
    //self.navigationController.navigationBarHidden = YES;
    
    self.view.backgroundColor = [UIColor redColor];
    self.navigationItem.title = @"第一页";
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
    btn.frame = CGRectMake(10, 100, 330, 50);
    btn.backgroundColor = [UIColor whiteColor];
    [btn setTitle:@"下一页" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(clickBtn) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];

}

- (void)clickBtn
{
    NSLog(@"下一页");
    SecondViewController *main = [[SecondViewController alloc] init];
    //UINavigationController *naviVC = [[UINavigationController alloc] initWithRootViewController:main];
    [self.navigationController pushViewController:main animated:YES];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
